home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Graphics Programming (2nd Edition)
/
Visual Basic Graphics Programming 2nd Edition.iso
/
OldSrc
/
CH6
/
SRC
/
EASY3D.FRM
< prev
next >
Wrap
Text File
|
1995-10-29
|
3KB
|
132 lines
VERSION 4.00
Begin VB.Form Easy3DForm
AutoRedraw = -1 'True
BackColor = &H00C0C0C0&
Caption = "Easy 3D"
ClientHeight = 4290
ClientLeft = 1860
ClientTop = 1650
ClientWidth = 4560
BeginProperty Font
name = "Times New Roman"
charset = 1
weight = 700
size = 24
underline = 0 'False
italic = -1 'True
strikethrough = 0 'False
EndProperty
Height = 4980
Left = 1800
LinkTopic = "Form1"
ScaleHeight = 286
ScaleMode = 3 'Pixel
ScaleWidth = 304
Top = 1020
Width = 4680
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
BackColor = &H00FFFF00&
BorderStyle = 0 'None
Height = 1335
Left = 0
ScaleHeight = 89
ScaleMode = 3 'Pixel
ScaleWidth = 305
TabIndex = 0
Top = 3000
Width = 4575
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
End
Attribute VB_Name = "Easy3DForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Sub SeparateColor(color As Long, r As Integer, g As Integer, b As Integer)
r = color Mod 256
g = color \ 256 Mod 256
b = color \ 256 \ 256
End Sub
Private Sub Form_Load()
Const txt = "3D text the easy way!"
Const GAP = 1
Dim x As Single
Dim y As Single
Dim r As Integer
Dim g As Integer
Dim b As Integer
Dim oldcolor As Long
CurrentX = 10
CurrentY = 10
Text3d Me, txt, vbBlack, RGB(127, 127, 127), vbWhite
CurrentX = 10
Text3d Me, txt, BackColor, vbBlack, vbWhite
SeparateColor BackColor, r, g, b
CurrentX = 10
Text3d Me, txt, BackColor, RGB(r / 2, g / 2, b / 2), vbWhite
CurrentX = 10
Text3d Me, txt, vbBlue, vbBlack, vbWhite
CurrentX = 10
Text3d Me, txt, Picture1.BackColor, vbBlack, vbWhite
Picture1.CurrentX = 10
Picture1.CurrentY = 10
Text3d Picture1, txt, Picture1.BackColor, vbBlack, vbWhite
SeparateColor BackColor, r, g, b
Picture1.CurrentX = 10
Text3d Picture1, txt, Picture1.BackColor, RGB(r / 2, g / 2, b / 2), vbWhite
End Sub
Sub Text3d(pic As Object, txt As String, fore As Long, shadow As Long, highlight As Long)
Const ADJUST = 1
Dim x As Single
Dim y As Single
Dim oldcolor As Long
oldcolor = pic.ForeColor
x = pic.CurrentX
y = pic.CurrentY
pic.ForeColor = highlight
pic.CurrentX = x - ADJUST
pic.CurrentY = y - ADJUST
pic.Print txt
pic.ForeColor = shadow
pic.CurrentX = x + ADJUST
pic.CurrentY = y + ADJUST
pic.Print txt
pic.ForeColor = fore
pic.CurrentX = x
pic.CurrentY = y
pic.Print txt
pic.ForeColor = oldcolor
End Sub
Private Sub mnuFileExit_Click()
Unload Me
End Sub